﻿using UnityEngine;
//using UnityGameFramework.Runtime;

public static partial class Config
{

    /// <summary>
    /// 默认配置
    /// </summary>
    public static class Default
    {
        public static string GameAssemblyName = "Game";

        public static bool IsEditorListeners = true;

        public const string DefaultDebugColor = Constant.Color.GREEN;

        public static float SpriteUIRatio = 100;

        /// <summary>
        /// 是否使用系统默认字体
        /// </summary>
        private static readonly bool IsSystemFont = false;

        private const string SystemFontPath = "Arial.ttf";
        public const string FontName = "DefaultFont";
        public const string FontName2 = "Default2";
        public static readonly string FontFullPath = Asset.GetFontAsset(FontName);
        public static readonly string FontFullPath2 = Asset.GetFontAsset(FontName2);

        private static Font m_Font;

        /// <summary>
        /// 系统默认字体
        /// </summary>
        public static Font Font
        {
            get
            {
                if (m_Font == null)
                {
                    if(IsSystemFont)
                    {
                        m_Font = Resources.GetBuiltinResource<Font>(SystemFontPath);
                    }
#if  UNITY_EDITOR
                    else
                    {
                        m_Font = UnityEditor.AssetDatabase.LoadAssetAtPath<Font>(FontFullPath);
                    }
#endif
                }
                return m_Font;
            }
        }

        public static Font Font2;

        public static void SetDefaultFont(Font defaultFont)
        {
            if (defaultFont == null)
            {
                Debug.LogError("Main font is invalid.");
                return;
            }

            m_Font = defaultFont;
        }
    }
}